package com.itheima.springmvc.service.Impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.itheima.springmvc.mapper.ItemsMapper;
import com.itheima.springmvc.pojo.Items;
import com.itheima.springmvc.pojo.ItemsExample;
import com.itheima.springmvc.service.ItemService;

/** 
* @author 上午茶
* @version 创建时间：2018年6月28日 下午12:38:38 
* 类说明 
*/
@Service
public class ItemServiceImpl implements ItemService{

	@Autowired
	private ItemsMapper itemsMapper;
	
	public List<Items> getItems() {
		ItemsExample example = new ItemsExample();
		
		List<Items> list = itemsMapper.selectByExampleWithBLOBs(example);
		
		return list;
	}

	public Items getItemEdit(Integer id) {
		
		Items items = itemsMapper.selectByPrimaryKey(id);
		
		return items;
	}

	public boolean updateItems(Items items) {
		ItemsExample example = new ItemsExample();
		
		int i = itemsMapper.updateByPrimaryKeySelective(items);
		
		if (i==1) {
			return true;
		}
		
		return false;
	}

}
